home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 4 / ETO Development Tools 4.iso / Essentials / MacApp Documentation / MacApp.TECH$ Archives / 1990 / Jan 90 / MacApp.Tech$ 1⁄26⁄90 / 0521-Re Re> re> TextEdit…-Jan90 < prev    next >
Encoding:
Text File  |  1991-03-06  |  2.2 KB  |  80 lines  |  [TEXT/GEOL]

  1. Item    4942682                         24-Jan-90        12:28
  2.  
  3. From:   NAVARRETE                       Peat Marwick, Ed Navarrete,VCA
  4.  
  5. To:     D5295                           Reseach SW Design, D Goldman,PRT
  6.  
  7. cc:     MACAPP.TECH$                    MacApp Technical
  8.  
  9. Sub:    Re: Re> re> TextEdit…
  10.  
  11. DAVE,
  12.  
  13.      Below is the code you need to implement wordbreak for your text editor.
  14.  
  15. Ed Navarrete
  16. KPMG Peat Marwick
  17.  
  18.  
  19. {********************************************
  20.  *  Set up special text edit workbreak function to tell text edit which
  21.  *  characters a line of text can be broken on.
  22.  ********************************************}
  23. {--------------------------------
  24.           MyWordBreak
  25.  --------------------------------}
  26. FUNCTION MyWordBreak(text: Ptr; charPos: Integer): Integer;
  27. CONST
  28.      kWordBreak=   1;
  29.      kDontWordBreak=   0;
  30. VAR
  31.      theChar   : CHAR;
  32. BEGIN
  33.      theChar := CharsPtr(text)^[charPos];
  34.  
  35.      { Following is the list that will determine a word break in the editor }
  36.      IF ( ( (theChar) <= ' ' ) |
  37.           ( (theChar) = ')' ) |
  38.           ( (theChar) = '(' ) THEN
  39.           MyWordBreak := kWordBreak
  40.      ELSE
  41.           MyWordBreak := kDontWordBreak;
  42. END;
  43.  
  44.  
  45. {--------------------------------
  46.          WordBreakProc
  47.  --------------------------------}
  48. {$S ARes}
  49. FUNCTION WordBreakProc(text: Ptr; charPos: Integer): Boolean; EXTERNAL;
  50. { Assembly language routine found in Break.a }
  51.  
  52.  
  53. --------------------------------
  54.          IMyTextEditor
  55.  --------------------------------}
  56. PROCEDURE TMyTextEditor.IMyTextEditor;
  57. BEGIN
  58.        { Your init code here }
  59.        fHTE^^.wordbreak := @WordBreakProc;
  60. END;
  61.  
  62.  
  63. ;--------------------------
  64. ;      FILE : Break.a
  65. ;--------------------------
  66. WORDBREAKPROC   PROC      EXPORT
  67.  
  68.                 IMPORT   MYWORDBREAK       ;Must be uppercase here
  69.                 MOVEM.L  D1-D2/A1,-(SP)
  70.                 CLR.W    -(SP)             ;Space for result
  71.                 MOVE.L   A0,-(SP)          ;move the ptr to stack
  72.                 MOVE.W   D0,-(SP)           ;move the charpos to Stack
  73.                 JSR      MYWORDBREAK
  74.                 MOVE.W   (SP)+,D0
  75.                 MOVEM.L (SP)+,D1-D2/A1
  76.                 RTS
  77.  
  78.                 END
  79.  
  80.